#include "cardlistdock.h"
#include "ui_cardlistdock.h"

#include "cardlistmodel.h"

CardListDock::CardListDock(QAbstractListModel *model, QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::CardListDock)
{
    ui->setupUi(this);

    ui->listView->setModel(model);

    CardListModel *cm = static_cast<CardListModel*>(model);

    cm->connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), SLOT(moveToBattleField(QModelIndex)));
    cm->connect(ui->listView, SIGNAL(clicked(QModelIndex)), SLOT(displayCard(QModelIndex)));
}

CardListDock::~CardListDock()
{
    delete ui;
}

